package com.sms.gui.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
import javax.swing.JTextPane;

import com.sms.util.ResourcesHandler;

public class NewSmsAction extends AbstractAction {

    private static final long serialVersionUID = 1L;
    private JTextPane message;

    public NewSmsAction(JTextPane m) {
        super();
        message = m;
        putValue(AbstractAction.NAME, "Nuovo messaggio");
        putValue(AbstractAction.SMALL_ICON, ResourcesHandler.SEND_IMG);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (JOptionPane.showConfirmDialog(null,
                "Sei sicuro di voler creare un nuovo messaggio", "Conferma",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
            message.setText("");
    }
}
